<?
session_start();
require_once('config.php');
require_once('class/cls_product.php');

$product			= new cls_product();;
$product_id = $_REQUEST['id'];
if($product_id != "" || $product_id != null){
	$product->delete_product_list($product_id);
}


$cmd = $_REQUEST['cmd'];
if($cmd == "Save"){

	$arr['coordinator_id'] = $_REQUEST['brand'];
	$arr['brand'] = $_REQUEST['brandname'];
	$arr['price'] = $_REQUEST['price'];
	$arr['status'] = ($_REQUEST['status'] == "")?"old":"new";
	
	$id = $product->insert_new_product($arr); 
	if($id != "" ||$id != null){
		?>
        <script language="javascript">
		window.location="products.php";
		</script>
        <?php
	}

}
?>
<html>
<head>
<title>Admin</title> 
<link href="../soethida/um_sty.css" rel="stylesheet" type="text/css">
<script language="javascript">
function deletefun(id){
	window.location ="products.php?id="+id;
}
</script>
</head>

<body leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0" marginwidth="0" marginheight="0" bgcolor="#F7F9F0">
<table id="Table_01" width="775" height="32" align="center" border="0" cellpadding="0" cellspacing="0">

	<tr>

		<td width="233" height="32"><img src="images/banner.jpg" width="774" height="100" alt=""></td>

		
	</tr>
</table>  
<table id="Table_02" width="775" height="24" align="center" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0">

	<tr>

		<td width="544" align="left" valign="middle">

		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<<a  href="index.php" class="ummenu" >Home</a>		

		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		
		<a href="customer_service.php" class="ummenu">Customer Services</a>
		
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		<a href="contact_us.php" class="ummenu">Contact Us</a>
		
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		<a href="aboutus.php" class="ummenu">About Us</a>


		

		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

		<td width="231" height="24" align="right" valign="middle"><a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_ja&trurl=http%3a%2f%2fwww.umgroups.com">

		</a>&nbsp;&nbsp;

		<a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_zt&trurl=http%3a%2f%2fwww.umgroups.com">		</a>&nbsp;&nbsp;

		<a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_ko&trurl=http%3a%2f%2fwww.umgroups.com">		</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>

	</tr>

</table>
<table id="Table_01" width="775" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF" style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC" >
		 <tr>
          <td>
   	
		  
		<table align="center" border="0" cellpadding="0" cellspacing="0" width="775" id="table6" bgcolor="#FFFFFF" style="border-bottom: 3px solid #DF8A0B;">


			<tr>

				<td width="50%" height="30" colspan="2" class="foot">&nbsp;</td>
			</tr>

			
			<tr>

				<td class="copy" style="padding-left: 3px" colspan="2">&nbsp;</td>
			</tr>
            <td width="50%"><tr>
            	<td>
<form  name="productform" action="product_update.php" method="post">
                	<table border="1" width="100%">
                    	<tr>
                        <td>Type:</td><td>
                        <?		
		$object	= $product->get_brand_list();
	?>
      <select name="brand">
	<?	  
		if (count($object))
		{
			foreach ($object as $row) {				
				echo '<option value="'.$row['coordinator_id'].'">'.$row["coordinator_name"].'</option>';
			}//iterating to show <option>......<option/>
		}//checking zero record count
	?>
      </select>
    </td>
                       </tr>
                       <tr>
                       	<td>Brand Name</td>
                        <td><input type="text" name="brandname"></td>
                       </tr>
                        <tr>
                       	<td>Price</td>
                        <td><input type="text" name="price"></td>
                       </tr>
                       <tr>
                       	<td>Choose Image</td>
                        <td><input type="File" name="img" value="1"></td>
                       </tr>
                        <tr>
                       	<td>Status</td>
                        <td><input type="checkbox" name="status" value="1">New</td>
                       </tr>
                       <tr>
                       	<td colspan="2"><input type="submit" name="cmd" value="Save"></td>
                       </tr>
                    </table>
                </td>
            </tr>

			<tr>

				<td height="30" colspan="2" class="foot">&nbsp;</td>
			</tr>
		</table>
		</td></tr></table>
       
        </form>

</body>
</html>

<?php

function gettypename($co_id){
	$strsql = "select coordinator_name from coordinator where coordinator_id='$co_id'";
	$result = mysql_query($strsql);
	$row = mysql_fetch_assoc($result);
	$co_name = $row['coordinator_name'];
}
?>
